package com.zc.service.impl;

import com.zc.mapper.CarouselMapper;
import com.zc.pojo.Carousel;
import com.zc.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author 曾川
 * @version 1.0.0
 * @ClassName CarouselServiceImpl.java
 * @Description TODO
 * @createTime 2021年07月07日 11:24:00
 */
@Service
public class CarouselServiceImpl implements CarouselService {

    @Autowired
    private CarouselMapper carouselMapper;


    /**
     * 查询所有轮播图列表
     *
     * @param isShow
     * @return
     */
    @Override
    public List<Carousel> queryAll(Integer isShow) {

        Example example = new Example(Carousel.class);
        example.orderBy("sort").desc();
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("isShow",isShow);
        List<Carousel> result = carouselMapper.selectByExample(example);
        return result;
    }


}
